<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Hoodoo::Logger::FileWriter</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/github.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>
    <div class="banner">
        <h1>
            <span class="type">Class</span>
            Hoodoo::Logger::FileWriter
                <span class="parent">&lt;
                    <a href="SlowWriter.html">Hoodoo::Logger::SlowWriter</a>
                </span>
        </h1>
        <ul class="files">
            <li><a href="../../../files/lib/hoodoo/logger/writers/file_writer_rb.html">lib/hoodoo/logger/writers/file_writer.rb</a></li>
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
    <div class="description">
      
<p>Writes unstructured messages to a file. <a
href="SlowWriter.html">Hoodoo::Logger::SlowWriter</a> subclass. See also <a
href="../Logger.html">Hoodoo::Logger</a>.</p>

    </div>








    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
        <dt>N</dt>
        <dd>
          <ul>
              <li>
                <a href="#method-c-new">new</a>
              </li>
          </ul>
        </dd>
        <dt>R</dt>
        <dd>
          <ul>
              <li>
                <a href="#method-i-report">report</a>
              </li>
          </ul>
        </dd>
    </dl>

    <!-- Includes -->
    <div class="sectiontitle">Included Modules</div>
    <ul>
        <li>
            <a href="FlattenerMixin.html">
              Hoodoo::Logger::FlattenerMixin
            </a>
        </li>
    </ul>









    <!-- Methods -->
      <div class="sectiontitle">Class Public methods</div>
        <div class="method">
          <div class="title method-title" id="method-c-new">
              <b>new</b>( pathname )
            <a href="../../../classes/Hoodoo/Logger/FileWriter.html#method-c-new" name="method-c-new" class="permalink">Link</a>
          </div>

            <div class="description">
              <p>Create a file writer instance. Files are written by opening, adding a log
message and closing again, to provide reliability. For this reason, this is
a <a href="SlowWriter.html">Hoodoo::Logger::SlowWriter</a> subclass.</p>

<p>If you want faster file access at the expense of immediate updates /
reliability due to buffering, open a file externally to create an I/O
stream and pass this persistently-open file&#39;s stream to an <a
href="StreamWriter.html">Hoodoo::Logger::StreamWriter</a> class instead.</p>
<dl class="rdoc-list note-list"><dt><code>pathname</code>
<dd>
<p>Full pathname of a file that can be opened in “ab” (append for writing at
end-of-file) mode.</p>
</dd></dl>
            </div>



            <div class="sourcecode">
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
              </p>
              <div id="method-c-new_source" class="dyn-source">
                <pre><span class="ruby-comment"># File lib/hoodoo/logger/writers/file_writer.rb, line 32</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">initialize</span>( <span class="ruby-identifier">pathname</span> )
  <span class="ruby-ivar">@pathname</span> = <span class="ruby-identifier">pathname</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
          </div>
      <div class="sectiontitle">Instance Public methods</div>
        <div class="method">
          <div class="title method-title" id="method-i-report">
              <b>report</b>( log_level, component, code, data )
            <a href="../../../classes/Hoodoo/Logger/FileWriter.html#method-i-report" name="method-i-report" class="permalink">Link</a>
          </div>

            <div class="description">
              <p>See <a
href="WriterMixin.html#method-i-report">Hoodoo::Logger::WriterMixin#report</a>.</p>
            </div>



            <div class="sourcecode">
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-i-report_source')" id="l_method-i-report_source">show</a>
              </p>
              <div id="method-i-report_source" class="dyn-source">
                <pre><span class="ruby-comment"># File lib/hoodoo/logger/writers/file_writer.rb, line 38</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">report</span>( <span class="ruby-identifier">log_level</span>, <span class="ruby-identifier">component</span>, <span class="ruby-identifier">code</span>, <span class="ruby-identifier">data</span> )
  <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>( <span class="ruby-ivar">@pathname</span>, <span class="ruby-string">&#39;ab&#39;</span> ) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">file</span> <span class="ruby-operator">|</span>
    <span class="ruby-identifier">file</span>.<span class="ruby-identifier">puts</span>( <span class="ruby-identifier">flatten</span>( <span class="ruby-identifier">log_level</span>, <span class="ruby-identifier">component</span>, <span class="ruby-identifier">code</span>, <span class="ruby-identifier">data</span> ) )
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
          </div>
</div>

    </div>
  </body>
</html>
